#include "test.h"
#include "../stack.h"
int main(int argc, char **argv)
{
  fprintf(stderr, "TEST: " __FILE__ " start\n");
  js_stack_t *stack = js_stack_new();
  /* push value */
  TEST(0, js_stack_size(stack));
  js_stack_push(stack, (void*)0xdeadbeaf);
  TEST(1, js_stack_size(stack));
  js_stack_push(stack, (void*)0xcafebabe);
  TEST(2, js_stack_size(stack));

  /* pop value */
  TEST((intptr_t)0xcafebabe, (intptr_t)js_stack_pop(stack));
  TEST((intptr_t)0xdeadbeaf, (intptr_t)js_stack_pop(stack));
  TEST(0, js_stack_size(stack));
  js_stack_push(stack, (void*)0x1234567);
  js_stack_push(stack, (void*)0xdeadbeaf);
  TEST((intptr_t)0xdeadbeaf, (intptr_t)js_stack_pop(stack));
  js_stack_push(stack, (void*)0xcafebabe);
  TEST(2, js_stack_size(stack));
  js_stack_delete(stack);
  fprintf(stderr, "TEST: " __FILE__ " end\n");
  return 0;
}
